/*
 * 作者:熊猫
 * 日期:2017 - 3 - 20 4 - 41 - 24
 *
 */

package net.lainiao.morethread.Chapter8.demo6;

import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.ReentrantLock;

/**
 * Created by Administrator on 2017/3/20.
 */
public class Task implements Runnable {
    ReentrantLock lock;

    public Task(ReentrantLock lock) {
        this.lock = lock;
    }

    @Override
    public void run() {
        lock.lock();
        try {
            TimeUnit.SECONDS.sleep(1);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}
